package com.cdp.zwy.background_manager_back.controller;

import com.cdp.zwy.background_manager_back.common.CustomException;
import com.cdp.zwy.background_manager_back.common.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Administrator
 * @version 1.0
 * @description: 接口测试（三种数据类型返回）
 * @date 2025/3/26 09:37
 */
@RestController
public class TestController {
    @GetMapping("/hello")
    public Result hello(){
        return Result.success("hello zwy");
    }
    @GetMapping("/count")
    public Result count(){
//        int a =  1 / 0;
        throw new CustomException("400","该接口禁止访问");
    }
    @GetMapping("/map")
    public Result map(){
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("name", "zwy");
        map.put("age", 18);
        return Result.success(map);
    }
}
